package com.market.fleamarket.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpSession;

@Controller
public class LogoutController {

    @GetMapping("/logout")
    public String logout(HttpSession session) {
        session.invalidate();//清除session中的登录信息
        return "redirect:/login";
    }

    // 添加游客退出方法
    @GetMapping("/guest-logout")
    public String guestLogout(HttpSession session) {
        session.invalidate();
        return "redirect:/login";
    }
}